package com.gamesnet.api;

import com.gamesnet.models.Utilisateur;

public class Session {

	private static volatile Session instance = null;
	private Utilisateur user;

	private Session(){
		super();
	}

	public static Session getInstance(){
		if(Session.instance == null){
			synchronized(Session.class) {
				if (Session.instance == null) {
					Session.instance = new Session();
				}
			}

		}
		return Session.instance;
	}

	public void setUser(Utilisateur user){
		this.user = user;
	}

	public Utilisateur getUser(){ return this.user; }

	public boolean hasUserConnected(){ return !(this.user == null);}
}
